
/**
 * Holds the information associated with an airport
 *
 */
public class Airport {

	private long airportID;
	private String code;
	private String city;
	
	/** hold if or the id has been set */
	private boolean idSet = false;
	
	
	/**
	 * constructor that takes the required values for an airport entry
	 * @param code the code of the airport
	 * @param city the city that an airport is from
	 */
	public Airport(String code, String city) {
		this.code = code;
		this.city = city;
	}
	
	public void setAirportID(long airportID) {
		this.airportID = airportID;
		setIDSet(true);
	}
	
	public long getAirportID() {
		return airportID;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getCode() {
		return code;
	}
	
	public void setCity(String city) {
		this.city = city;
	}
	
	public String getCity() {
		return city;
	}

	private void setIDSet(boolean isIDSet) {
		this.idSet = isIDSet;
	}

	public boolean isIDSet() {
		return idSet;
	}
	
	@Override
	public boolean equals(Object ap) {
		if (ap instanceof Airport) {
			Airport apOther = (Airport) ap;
			return apOther.code.equals(code);
		}
		return false;
	}
	
    @Override
    public int hashCode() {
        return code.hashCode();
    }

}

